import java.util.Scanner;

public class ShoppingSystem {
    CustomerSet customerSet = new CustomerSet();
    Administrator administrator = new Administrator(customerSet);

    ShoppingSystem(){
        System.out.println("欢迎使用购物管理系统！！！");
    }
    public void start(){
        Scanner input = new Scanner(System.in);
        while (true){
            System.out.println("请选择");
            System.out.println("1--管理员模式");
            System.out.println("2--用户模式");
            System.out.println("3--退出");
            int choose = 0;
            try{
                choose = input.nextInt();
            }catch (Exception e){
                while (input.hasNext()) {
                    if (input.hasNextLine()) {
                        input.nextLine();
                        break;
                    } else {
                        input.next();
                    }
                }
            }
            switch (choose){
                case 1:
                    administrator.menu();
                    break;
                case 2:
                    customerSet.menu();
                    break;
                case 3:
                    System.out.println("感谢您的使用，再见。");
                    return;
                default:
                    System.out.println("输入不合法，请重新输入");
            }
        }

    }//
}
